﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Oracle.EntityFrameworkCore.Metadata;

namespace SOEI.Solution.Migrations
{
    public partial class NCLF_NewEntity_Initial : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "NCLF_ABP_REPOSITORY",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<int>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ABP_REPOSITORY", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ATTACHS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    FILENAME = table.Column<string>(nullable: true),
                    PATH = table.Column<string>(nullable: true),
                    SIZE = table.Column<long>(nullable: false),
                    EXTENSION = table.Column<string>(nullable: true),
                    CONTENTTYPE = table.Column<string>(nullable: true),
                    MODULEID = table.Column<Guid>(nullable: false),
                    ORDERNUM = table.Column<int>(nullable: false),
                    FILETYPE = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ATTACHS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_BUYERS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    NAME = table.Column<string>(maxLength: 20, nullable: true),
                    SEX = table.Column<string>(maxLength: 8, nullable: true),
                    IDNUMBER = table.Column<string>(nullable: true),
                    PHONENUMBER = table.Column<string>(nullable: true),
                    PRELOCATION = table.Column<string>(maxLength: 50, nullable: true),
                    HOUSEPURPOSE = table.Column<string>(maxLength: 128, nullable: true),
                    PREAREA = table.Column<string>(maxLength: 128, nullable: true),
                    USERTAG = table.Column<string>(nullable: true),
                    REMARK = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_BUYERS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_BUYQUALIFICATIONAPPLYS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    NAME = table.Column<string>(nullable: true),
                    PHONENUMBER = table.Column<string>(nullable: true),
                    CERTIFICATETYPE = table.Column<string>(nullable: true),
                    IDNUMBER = table.Column<string>(nullable: true),
                    MARRIAGECONDITION = table.Column<string>(nullable: true),
                    IFCENSUSREGISTER = table.Column<string>(nullable: true),
                    BUYERCONDITION = table.Column<string>(nullable: true),
                    OWNPROPERTYCOUNT = table.Column<string>(nullable: true),
                    ENTERPEOPLE = table.Column<string>(nullable: true),
                    APPLYTIME = table.Column<DateTime>(nullable: false),
                    APPLYSTATUS = table.Column<string>(nullable: true),
                    AUDITRESULT = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_BUYQUALIFICATIONAPPLYS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_BUYQUALIFICATIONS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    APPLYID = table.Column<string>(nullable: true),
                    NAME = table.Column<string>(nullable: true),
                    IDNUMBER = table.Column<string>(nullable: true),
                    PHONENUMBER = table.Column<string>(nullable: true),
                    APPLYTIME = table.Column<DateTime>(nullable: false),
                    AUDITRESULT = table.Column<string>(nullable: true),
                    EFFECTIVEDATE = table.Column<string>(nullable: true),
                    PURCHASECODE = table.Column<string>(nullable: true),
                    IFNETSIGN = table.Column<string>(nullable: true),
                    EXPLAIN = table.Column<string>(nullable: true),
                    ENTERPEOPLE = table.Column<string>(nullable: true),
                    AUDITTIME = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_BUYQUALIFICATIONS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ORGSIGNETS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    JGBH = table.Column<string>(nullable: true),
                    RYBH = table.Column<string>(nullable: true),
                    ACCOUNTID = table.Column<string>(nullable: true),
                    ORGID = table.Column<string>(nullable: true),
                    IDENTIFYMODULEID = table.Column<Guid>(nullable: false),
                    LICENSEMODULEID = table.Column<Guid>(nullable: false),
                    SIGNETMODULEID = table.Column<Guid>(nullable: false),
                    STATUS = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ORGSIGNETS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_PARAMETERS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<string>(nullable: false),
                    VALUE = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_PARAMETERS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_PDF",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<string>(nullable: false),
                    WJNR = table.Column<byte[]>(nullable: true),
                    YWBH = table.Column<string>(nullable: true),
                    YWLX = table.Column<string>(nullable: true),
                    LRSJ = table.Column<DateTime>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_PDF", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_PLEDGEBOOKS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    JGBH = table.Column<string>(nullable: true),
                    PLEDGEBOOKMODULEID = table.Column<Guid>(nullable: false),
                    STATUS = table.Column<string>(nullable: true),
                    REMARK = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_PLEDGEBOOKS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ROOMVERIFYAPPLYS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    ORGANIZEID = table.Column<long>(nullable: false),
                    ROOMVERIFYID = table.Column<long>(nullable: false),
                    ROOMVERIFYCODE = table.Column<string>(maxLength: 20, nullable: true),
                    VERIFYUSERID = table.Column<long>(nullable: true),
                    VERIFYTIME = table.Column<DateTime>(nullable: false),
                    STATECODE = table.Column<string>(maxLength: 20, nullable: true),
                    REMARK = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ROOMVERIFYAPPLYS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ROOMVERIFYS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    CERTIFICATECODE = table.Column<string>(maxLength: 20, nullable: true),
                    CERTIFICATENAME = table.Column<string>(maxLength: 50, nullable: true),
                    STATECODE = table.Column<string>(maxLength: 20, nullable: true),
                    REMARK = table.Column<string>(nullable: true),
                    PROPERTYCARDNUM = table.Column<string>(nullable: true),
                    HOUSELOCATED = table.Column<string>(nullable: true),
                    PROPERTYSTATE = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ROOMVERIFYS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_SELLERS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    NAME = table.Column<string>(maxLength: 20, nullable: true),
                    SEX = table.Column<string>(maxLength: 8, nullable: true),
                    IDNUMBER = table.Column<string>(nullable: true),
                    PHONENUMBER = table.Column<string>(nullable: true),
                    HOUSETITLENUMBER = table.Column<string>(nullable: true),
                    HOUSINGLOCATION = table.Column<string>(maxLength: 50, nullable: true),
                    SELLINGPRICE = table.Column<string>(nullable: true),
                    HOUSEPURPOSE = table.Column<string>(maxLength: 128, nullable: true),
                    HOUSEAREA = table.Column<string>(maxLength: 128, nullable: true),
                    USERTAG = table.Column<string>(nullable: true),
                    REMARK = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_SELLERS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_SIGNETGRANTS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    RYBH = table.Column<string>(nullable: true),
                    JGBH = table.Column<string>(nullable: true),
                    SQZT = table.Column<string>(nullable: true),
                    SQFS = table.Column<int>(nullable: false),
                    SXRQ = table.Column<DateTime>(nullable: false),
                    REMARK = table.Column<string>(nullable: true),
                    ACCOUNTID = table.Column<string>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_SIGNETGRANTS", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "NCLF_ROOMVERIFYPROPERTYS",
                schema: "FGXT_YW",
                columns: table => new
                {
                    ID = table.Column<long>(nullable: false)
                        .Annotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn),
                    CREATIONTIME = table.Column<DateTime>(nullable: false),
                    CREATORUSERID = table.Column<long>(nullable: true),
                    LASTMODIFICATIONTIME = table.Column<DateTime>(nullable: true),
                    LASTMODIFIERUSERID = table.Column<long>(nullable: true),
                    PROPERTYOWNERNAME = table.Column<string>(nullable: true),
                    PROPERTYOWNERIDENTITYCARD = table.Column<string>(nullable: true),
                    ROOMVERIFYID = table.Column<long>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NCLF_ROOMVERIFYPROPERTYS", x => x.ID);
                    table.ForeignKey(
                        name: "FK_NCLF_ROOMVERIFYPROPERTY_RVI",
                        column: x => x.ROOMVERIFYID,
                        principalSchema: "FGXT_YW",
                        principalTable: "NCLF_ROOMVERIFYS",
                        principalColumn: "ID",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_APPLYS_ROOMVERIFYID",
                schema: "FGXT_YW",
                table: "NCLF_ROOMVERIFYAPPLYS",
                column: "ROOMVERIFYID");

            migrationBuilder.CreateIndex(
                name: "IX_NCLF_ROOMVERIFYPROPERTYS_RV",
                schema: "FGXT_YW",
                table: "NCLF_ROOMVERIFYPROPERTYS",
                column: "ROOMVERIFYID");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "NCLF_ABP_REPOSITORY",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ATTACHS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_BUYERS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_BUYQUALIFICATIONAPPLYS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_BUYQUALIFICATIONS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ORGSIGNETS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_PARAMETERS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_PDF",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_PLEDGEBOOKS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ROOMVERIFYAPPLYS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ROOMVERIFYPROPERTYS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_SELLERS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_SIGNETGRANTS",
                schema: "FGXT_YW");

            migrationBuilder.DropTable(
                name: "NCLF_ROOMVERIFYS",
                schema: "FGXT_YW");
        }
    }
}
